package com.lzh.chatnote.common.constant;

public class RedisKey {

    private static final String BASE_KEY = "chatNote:";

    //登录通过的token
    public static final String USER_TOKEN = "user:token_%s";


    //微信登录openid
    public static final String USER_OPENID = "openid_%s";


    /**
     * 在线用户列表
     */
    public static final String ONLINE_UID_ZET = "online";

    /**
     * 离线用户列表
     */
    public static final String OFFLINE_UID_ZET = "offline";


    /**
     * 缓存key 用户信息数据
     */
    public static final String  CACHE_USER_KEY = "userInfo:uuid_%s";

    /**
     * 缓存key 用户权限数据
     */
    public static final String  CACHE_USER_PERMISSION_KEY = "userPermission:uuid_%s";

    /**
     * 修改用户信息key
     */
    public static final String  CACHE_USER_UPDATE_KEY = "userUpdate:uuid_%s";

    /**
     * 组装成的用户信息简介key
     */
    public static final String  USER_SUMMARY_KEY = "userSummary:uuid_%s";

    /**
     * 房间缓存key
     */
    public static final String  ROOM_KEY = "room:id_%s";

    /**
     * 热点房间最新消息id缓存key
     */
    public static final String  ROOM_HOT_KEY = "roomHot:id_%s";


    /*
     * 群组缓存key
     */
    public static final String  ROOM_GROUP_KEY = "roomGroup:id_%s";

    /**
     * 群成员缓存key
     */
    public static final String  GROUP_MEMBER_KEY = "groupMember:roomId_%s";

    /**
     * 单聊缓存key
     */
    public static final String  SINGLE_ROOM_KEY = "singleRoom:id_%s";




    /**
     * 获取redis key
     * @param key 拼接key前缀
     * @param objects 拼接key
     * @return
     */
    public static String getKey(String key, Object... objects) {
        return BASE_KEY + String.format(key, objects);
    }
}
